package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 98152
 * Date: 2024-06-03
 * Time: 15:59
 */

class Add1 implements Runnable {
    private int x;
    private int y;

    public Add1(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public void run() {
        System.out.println("x+y=" + (this.x + this.y));
    }
}

class Add2 implements Runnable {
    private int x;
    private int y;
    private int z;

    public Add2(int x, int y, int z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    @Override
    public void run() {
        System.out.println("x+y+z=" +(this.x+this.y+this.z));
    }
}

class Sub1 implements Runnable {
    private int x;
    private int y;

    public Sub1(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public void run() {
        System.out.println("x-y=" + (this.x-this.y));
    }
}

class Sub2 implements Runnable {
    private int x;
    private int y;
    private int z;

    public Sub2(int x, int y, int z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    @Override
    public void run() {
        System.out.println("x-y-z=" +(this.x-this.y-this.z));
    }
}
public class ZhaiZhiJie1 {
    public static void main(String[] args) {
        Add1 add1 = new Add1(3,5);
        new Thread(add1).start();
        Add2 add2 = new Add2(3,5,7);
        new Thread(add2).start();
        Sub1 sub1 = new Sub1(20,13);
        new Thread(sub1).start();
        Sub2 sub2 = new Sub2(60,13,15);
        new Thread(sub2).start();
    }
}
